FROM alpine:edge

LABEL author="张仪 <wittcnezh@foxmail.coms>"

RUN apk add --no-cache --update-cache bash curl wget unzip gradle openjdk8

ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/bin/

ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk/bin/

ENV LANG=en_US.UTF-8

ENV OFBIZ_VERSION 17.12.01

RUN mkdir -p /opt && \
    cd /opt && \
    curl -vskS https://downloads.apache.org/ofbiz/apache-ofbiz-${OFBIZ_VERSION}.zip | unzip -d && \
    cd apache-ofbiz-${OFBIZ_VERSION} && \
    gradle cleanAll build

ENV OFBIZ_HOME /opt/apache-ofbiz-${OFBIZ_VERSION}

CMD [ "gradle", "ofbiz --loadAll" ]
